<?php
/**
 * @package Joomla
 * @subpackage Jmonoslideshow
 * @copyright (C) 2010 - Matthieu BARBE - www.ccomca.com
 * @license GNU/GPL v2
 * 
 * Jmonoslideshow is a Joomla extension for album.
 *
 * Jmonoslideshow uses :
 * album (http://www.monoslideshow.com/)
 * Plupload (http://www.plupload.com/) by Moxicode Systems
 * json class by Michal Migurski, Matt Knapp, Brett Stimmerman
 * jquery a JavaScript Library (http://jquery.com/)
 * getid3 library (http://getid3.sourceforge.net/)
 * swfobject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file (http://code.google.com/p/swfobject/)
 * Chained Selects jQuery Plugin (http://www.appelsiini.net/2010/jquery-chained-selects)
 *
 * Jmonoslideshow is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the model controller
 *
 * @package    album
 * @subpackage Views
 */

class JmonoslideshowViewSlideshow extends JView
{
	protected $state;
	protected $model;
	protected $form;
	
	/**
	 * model view display method
	 *
	 * @return void
	 **/
	function display($tpl = null)
	{
		//Load pane behavior
			
		
		$this->state	= $this->get('State');
		$this->model	= $this->get('Item');
		$this->form 		= $this->get('Form');
		
		if (count($errors = $this->get('Errors'))) {
			JError::raiseError(500, implode("\n", $errors));
			return false;
		}
		
		
		$lang =& JFactory::getLanguage();
		$extension = 'com_jmonoslideshow';
		$base_dir = JPATH_SITE;
		$lang->load($extension, $base_dir, '', true);
		
		$this->addToolbar();
		parent::display($tpl);
	}// function
	
	/**
	 * Add the page title and toolbar.
	 *
	 * @since	1.6
	 */
	protected function addToolbar()
	{
		JRequest::setVar('hidemainmenu', true);

		$user		= JFactory::getUser();
		$isNew		= ($this->model->id == 0);
		$checkedOut	= !($this->model->checked_out == 0 || $this->model->checked_out == $user->get('id'));
		JToolBarHelper::title(JText::_('COM_JMONOSLIDESHOW_MODEL_' . ($isNew ? 'NEW' : 'EDIT') . '_TITLE'), 'model');
		
			JToolBarHelper::apply('slideshow.apply');
			JToolBarHelper::save('slideshow.save');
			JToolBarHelper::save2new('slideshow.save2new');
			JToolBarHelper::save2copy('slideshow.save2copy');
		
		if (empty($this->model->id)) {
			JToolBarHelper::cancel('slideshow.cancel');
		}
		else {
			JToolBarHelper::cancel('slideshow.cancel', 'JTOOLBAR_CLOSE');
		}

		JToolBarHelper::divider();
		
	}
	

}// class
